﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Threading.Tasks;
using JX.Core;
using JX.Core.Entity;
using JX.Infrastructure.Common;
using MyADO;

namespace JX.ADO
{
	/// <summary>
	/// 数据库表：Contacter 的仓储实现类.
	/// </summary>
	public partial class ContacterRepositoryADO : IContacterRepositoryADO
	{
		#region 数据上下文
		/// <summary>
		/// 数据上下文
		/// </summary>
		private IDBOperator _DB;

		/// <summary>
		/// 构造器注入
		/// </summary>
		/// <param name="DB"></param>
		public ContacterRepositoryADO(IDBOperator DB)
		{
			_DB = DB;
		}
		#endregion
		
		#region 得到第一行第一列的值
		/// <summary>
		/// 得到第一行第一列的值
		/// </summary>
		/// <param name="statistic">要返回的字段（如：count(*) 或者 UserName）</param>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual string GetScalar(string statistic, string strWhere = "", Dictionary<string, object> dict = null)
		{
			string strSQL = "select " + statistic + " from Contacter where 1=1 ";
			if (!string.IsNullOrEmpty(strWhere))
			{
				strSQL += strWhere;
			}
			return _DB.ExeSQLScalar(strSQL, dict);
		}
		/// <summary>
		/// 得到第一行第一列的值（异步方式）
		/// </summary>
		/// <param name="statistic">要返回的字段（如：count(*) 或者 UserName）</param>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual async Task<string> GetScalarAsync(string statistic, string strWhere = "", Dictionary<string, object> dict = null)
		{
			string strSQL = "select " + statistic + " from Contacter where 1=1 ";
			if (!string.IsNullOrEmpty(strWhere))
			{
				strSQL += strWhere;
			}
			return await Task.Run(() => _DB.ExeSQLScalar(strSQL, dict));
		}
		#endregion
		
		#region 得到所有行数
		/// <summary>
		/// 得到所有行数
		/// </summary>
		/// <returns></returns>
		public virtual int GetCount()
		{
			return DataConverter.CLng(GetScalar("count(*)"), 0);
		}
		/// <summary>
		/// 得到所有行数（异步方式）
		/// </summary>
		/// <returns></returns>
		public virtual async Task<int> GetCountAsync()
		{
			return DataConverter.CLng(await GetScalarAsync("count(*)"), 0);
		}

		/// <summary>
		/// 得到所有行数
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual int GetCount(string strWhere, Dictionary<string, object> dict = null)
		{
			return DataConverter.CLng(GetScalar("count(*)", strWhere, dict), 0);
		}
		/// <summary>
		/// 得到所有行数（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual async Task<int> GetCountAsync(string strWhere, Dictionary<string, object> dict = null)
		{
			return DataConverter.CLng(await GetScalarAsync("count(*)", strWhere, dict), 0);
		}
		#endregion
		
		#region 得到最大ID、最新ID
		/// <summary>
		/// 得到数据表中第一个主键的最大数值
		/// </summary>
		/// <returns></returns>
		public virtual int GetMaxID()
		{
			return _DB.GetMaxID("Contacter", "ContacterID");
		}
		/// <summary>
		/// 得到数据表中第一个主键的最大数值（异步方式）
		/// </summary>
		/// <returns></returns>
		public virtual async Task<int> GetMaxIDAsync()
		{
			return await Task.Run(() => _DB.GetMaxID("Contacter", "ContacterID"));
		}

		/// <summary>
		/// 得到数据表中第一个主键的最大数值加1
		/// </summary>
		/// <returns></returns>
		public virtual int GetNewID()
		{
			return GetMaxID() + 1;
		}
		/// <summary>
		/// 得到数据表中第一个主键的最大数值加1（异步方式）
		/// </summary>
		/// <returns></returns>
		public virtual async Task<int> GetNewIDAsync()
		{
			return await GetMaxIDAsync() + 1;
		}
		#endregion
		
		#region 验证是否存在
		/// <summary>
		/// 检查数据是否存在
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual bool IsExist(string strWhere, Dictionary<string, object> dict = null)
		{
			if (GetCount(strWhere, dict) == 0)
			{
				return false;
			}
			return true;
		}

		/// <summary>
		/// 检查数据是否存在（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual async Task<bool> IsExistAsync(string strWhere, Dictionary<string, object> dict = null)
		{
			int count = await GetCountAsync(strWhere, dict);
			if (count == 0)
			{
				return false;
			}
			return true;
		}
		#endregion
		
		#region 添加
		/// <summary>
		/// 增加一条记录
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual bool Add(ContacterEntity entity)
		{
			if(entity.ContacterID <= 0) entity.ContacterID=GetNewID();
			Dictionary<string, object> dict = new Dictionary<string, object>();
			GetParameters(entity,dict);

			string strSQL = "insert into Contacter ("+
							"ContacterID,"+
							"ClientID,"+
							"ParentID,"+
							"UserName,"+
							"UserType,"+
							"TrueName,"+
							"Sex,"+
							"Title,"+
							"Company,"+
							"Department,"+
							"Position,"+
							"Operation,"+
							"CompanyAddress,"+
							"CompanySize,"+
							"CompanyType,"+
							"CompanyIndustry,"+
							"Email,"+
							"Homepage,"+
							"QQ,"+
							"ICQ,"+
							"MSN,"+
							"Yahoo,"+
							"UC,"+
							"Aim,"+
							"OfficePhone,"+
							"HomePhone,"+
							"PHS,"+
							"Fax,"+
							"Mobile,"+
							"Country,"+
							"Province,"+
							"City,"+
							"Area,"+
							"Address,"+
							"ZipCode,"+
							"NativePlace,"+
							"Nation,"+
							"Birthday,"+
							"IDCard,"+
							"IDCardPic,"+
							"IsPassIDCard,"+
							"IDCardProvince,"+
							"IDCardCity,"+
							"IDCardArea,"+
							"IDCardAddress,"+
							"BankName,"+
							"BankAccount,"+
							"BankCard,"+
							"BankCardPic,"+
							"IsPassBankCard,"+
							"Marriage,"+
							"Family,"+
							"Income,"+
							"Education,"+
							"GraduateFrom,"+
							"InterestsOfLife,"+
							"InterestsOfCulture,"+
							"InterestsOfAmusement,"+
							"InterestsOfSport,"+
							"InterestsOfOther,"+
							"CreateTime,"+
							"UpdateTime,"+
							"Owner,"+
							"EmergencyContact) "+
							"values("+
							"@ContacterID,"+
							"@ClientID,"+
							"@ParentID,"+
							"@UserName,"+
							"@UserType,"+
							"@TrueName,"+
							"@Sex,"+
							"@Title,"+
							"@Company,"+
							"@Department,"+
							"@Position,"+
							"@Operation,"+
							"@CompanyAddress,"+
							"@CompanySize,"+
							"@CompanyType,"+
							"@CompanyIndustry,"+
							"@Email,"+
							"@Homepage,"+
							"@QQ,"+
							"@ICQ,"+
							"@MSN,"+
							"@Yahoo,"+
							"@UC,"+
							"@Aim,"+
							"@OfficePhone,"+
							"@HomePhone,"+
							"@PHS,"+
							"@Fax,"+
							"@Mobile,"+
							"@Country,"+
							"@Province,"+
							"@City,"+
							"@Area,"+
							"@Address,"+
							"@ZipCode,"+
							"@NativePlace,"+
							"@Nation,"+
							"@Birthday,"+
							"@IDCard,"+
							"@IDCardPic,"+
							"@IsPassIDCard,"+
							"@IDCardProvince,"+
							"@IDCardCity,"+
							"@IDCardArea,"+
							"@IDCardAddress,"+
							"@BankName,"+
							"@BankAccount,"+
							"@BankCard,"+
							"@BankCardPic,"+
							"@IsPassBankCard,"+
							"@Marriage,"+
							"@Family,"+
							"@Income,"+
							"@Education,"+
							"@GraduateFrom,"+
							"@InterestsOfLife,"+
							"@InterestsOfCulture,"+
							"@InterestsOfAmusement,"+
							"@InterestsOfSport,"+
							"@InterestsOfOther,"+
							"@CreateTime,"+
							"@UpdateTime,"+
							"@Owner,"+
							"@EmergencyContact)";
			
			return _DB.ExeSQLResult(strSQL,dict);
		}
		/// <summary>
		/// 增加一条记录（异步方式）
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual async Task<bool> AddAsync(ContacterEntity entity)
		{
			if(entity.ContacterID <= 0) entity.ContacterID=GetNewID();
			Dictionary<string, object> dict = new Dictionary<string, object>();
			GetParameters(entity, dict);

			string strSQL = "insert into Contacter ("+
							"ContacterID,"+
							"ClientID,"+
							"ParentID,"+
							"UserName,"+
							"UserType,"+
							"TrueName,"+
							"Sex,"+
							"Title,"+
							"Company,"+
							"Department,"+
							"Position,"+
							"Operation,"+
							"CompanyAddress,"+
							"CompanySize,"+
							"CompanyType,"+
							"CompanyIndustry,"+
							"Email,"+
							"Homepage,"+
							"QQ,"+
							"ICQ,"+
							"MSN,"+
							"Yahoo,"+
							"UC,"+
							"Aim,"+
							"OfficePhone,"+
							"HomePhone,"+
							"PHS,"+
							"Fax,"+
							"Mobile,"+
							"Country,"+
							"Province,"+
							"City,"+
							"Area,"+
							"Address,"+
							"ZipCode,"+
							"NativePlace,"+
							"Nation,"+
							"Birthday,"+
							"IDCard,"+
							"IDCardPic,"+
							"IsPassIDCard,"+
							"IDCardProvince,"+
							"IDCardCity,"+
							"IDCardArea,"+
							"IDCardAddress,"+
							"BankName,"+
							"BankAccount,"+
							"BankCard,"+
							"BankCardPic,"+
							"IsPassBankCard,"+
							"Marriage,"+
							"Family,"+
							"Income,"+
							"Education,"+
							"GraduateFrom,"+
							"InterestsOfLife,"+
							"InterestsOfCulture,"+
							"InterestsOfAmusement,"+
							"InterestsOfSport,"+
							"InterestsOfOther,"+
							"CreateTime,"+
							"UpdateTime,"+
							"Owner,"+
							"EmergencyContact) "+
							"values("+
							"@ContacterID,"+
							"@ClientID,"+
							"@ParentID,"+
							"@UserName,"+
							"@UserType,"+
							"@TrueName,"+
							"@Sex,"+
							"@Title,"+
							"@Company,"+
							"@Department,"+
							"@Position,"+
							"@Operation,"+
							"@CompanyAddress,"+
							"@CompanySize,"+
							"@CompanyType,"+
							"@CompanyIndustry,"+
							"@Email,"+
							"@Homepage,"+
							"@QQ,"+
							"@ICQ,"+
							"@MSN,"+
							"@Yahoo,"+
							"@UC,"+
							"@Aim,"+
							"@OfficePhone,"+
							"@HomePhone,"+
							"@PHS,"+
							"@Fax,"+
							"@Mobile,"+
							"@Country,"+
							"@Province,"+
							"@City,"+
							"@Area,"+
							"@Address,"+
							"@ZipCode,"+
							"@NativePlace,"+
							"@Nation,"+
							"@Birthday,"+
							"@IDCard,"+
							"@IDCardPic,"+
							"@IsPassIDCard,"+
							"@IDCardProvince,"+
							"@IDCardCity,"+
							"@IDCardArea,"+
							"@IDCardAddress,"+
							"@BankName,"+
							"@BankAccount,"+
							"@BankCard,"+
							"@BankCardPic,"+
							"@IsPassBankCard,"+
							"@Marriage,"+
							"@Family,"+
							"@Income,"+
							"@Education,"+
							"@GraduateFrom,"+
							"@InterestsOfLife,"+
							"@InterestsOfCulture,"+
							"@InterestsOfAmusement,"+
							"@InterestsOfSport,"+
							"@InterestsOfOther,"+
							"@CreateTime,"+
							"@UpdateTime,"+
							"@Owner,"+
							"@EmergencyContact)";
			
			return await Task.Run(() => _DB.ExeSQLResult(strSQL, dict));
		}

		/// <summary>
		/// 增加一条记录，返回新的ID号。需要有一个单一主键，并且开启有标识符属性
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual int Insert(ContacterEntity entity)
		{
			if(entity.ContacterID <= 0) entity.ContacterID=GetNewID();			
			Dictionary<string, object> dict = new Dictionary<string, object>();
			GetParameters(entity,dict);

			string strSQL = "insert into Contacter ("+
							"ContacterID,"+
							"ClientID,"+
							"ParentID,"+
							"UserName,"+
							"UserType,"+
							"TrueName,"+
							"Sex,"+
							"Title,"+
							"Company,"+
							"Department,"+
							"Position,"+
							"Operation,"+
							"CompanyAddress,"+
							"CompanySize,"+
							"CompanyType,"+
							"CompanyIndustry,"+
							"Email,"+
							"Homepage,"+
							"QQ,"+
							"ICQ,"+
							"MSN,"+
							"Yahoo,"+
							"UC,"+
							"Aim,"+
							"OfficePhone,"+
							"HomePhone,"+
							"PHS,"+
							"Fax,"+
							"Mobile,"+
							"Country,"+
							"Province,"+
							"City,"+
							"Area,"+
							"Address,"+
							"ZipCode,"+
							"NativePlace,"+
							"Nation,"+
							"Birthday,"+
							"IDCard,"+
							"IDCardPic,"+
							"IsPassIDCard,"+
							"IDCardProvince,"+
							"IDCardCity,"+
							"IDCardArea,"+
							"IDCardAddress,"+
							"BankName,"+
							"BankAccount,"+
							"BankCard,"+
							"BankCardPic,"+
							"IsPassBankCard,"+
							"Marriage,"+
							"Family,"+
							"Income,"+
							"Education,"+
							"GraduateFrom,"+
							"InterestsOfLife,"+
							"InterestsOfCulture,"+
							"InterestsOfAmusement,"+
							"InterestsOfSport,"+
							"InterestsOfOther,"+
							"CreateTime,"+
							"UpdateTime,"+
							"Owner,"+
							"EmergencyContact) "+
							"values("+
							"@ContacterID,"+
							"@ClientID,"+
							"@ParentID,"+
							"@UserName,"+
							"@UserType,"+
							"@TrueName,"+
							"@Sex,"+
							"@Title,"+
							"@Company,"+
							"@Department,"+
							"@Position,"+
							"@Operation,"+
							"@CompanyAddress,"+
							"@CompanySize,"+
							"@CompanyType,"+
							"@CompanyIndustry,"+
							"@Email,"+
							"@Homepage,"+
							"@QQ,"+
							"@ICQ,"+
							"@MSN,"+
							"@Yahoo,"+
							"@UC,"+
							"@Aim,"+
							"@OfficePhone,"+
							"@HomePhone,"+
							"@PHS,"+
							"@Fax,"+
							"@Mobile,"+
							"@Country,"+
							"@Province,"+
							"@City,"+
							"@Area,"+
							"@Address,"+
							"@ZipCode,"+
							"@NativePlace,"+
							"@Nation,"+
							"@Birthday,"+
							"@IDCard,"+
							"@IDCardPic,"+
							"@IsPassIDCard,"+
							"@IDCardProvince,"+
							"@IDCardCity,"+
							"@IDCardArea,"+
							"@IDCardAddress,"+
							"@BankName,"+
							"@BankAccount,"+
							"@BankCard,"+
							"@BankCardPic,"+
							"@IsPassBankCard,"+
							"@Marriage,"+
							"@Family,"+
							"@Income,"+
							"@Education,"+
							"@GraduateFrom,"+
							"@InterestsOfLife,"+
							"@InterestsOfCulture,"+
							"@InterestsOfAmusement,"+
							"@InterestsOfSport,"+
							"@InterestsOfOther,"+
							"@CreateTime,"+
							"@UpdateTime,"+
							"@Owner,"+
							"@EmergencyContact)";
			if(_DB.ExeSQLResult(strSQL,dict))
			{
				return DataConverter.CLng(entity.ContacterID);
			}
			return -1;
		}
		/// <summary>
		/// 增加一条记录，返回新的ID号。需要有一个单一主键，并且开启有标识符属性（异步方式）
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual async Task<int> InsertAsync(ContacterEntity entity)
		{
			if(entity.ContacterID <= 0) entity.ContacterID=GetNewID();			
			Dictionary<string, object> dict = new Dictionary<string, object>();
			GetParameters(entity,dict);

			string strSQL = "insert into Contacter ("+
							"ContacterID,"+
							"ClientID,"+
							"ParentID,"+
							"UserName,"+
							"UserType,"+
							"TrueName,"+
							"Sex,"+
							"Title,"+
							"Company,"+
							"Department,"+
							"Position,"+
							"Operation,"+
							"CompanyAddress,"+
							"CompanySize,"+
							"CompanyType,"+
							"CompanyIndustry,"+
							"Email,"+
							"Homepage,"+
							"QQ,"+
							"ICQ,"+
							"MSN,"+
							"Yahoo,"+
							"UC,"+
							"Aim,"+
							"OfficePhone,"+
							"HomePhone,"+
							"PHS,"+
							"Fax,"+
							"Mobile,"+
							"Country,"+
							"Province,"+
							"City,"+
							"Area,"+
							"Address,"+
							"ZipCode,"+
							"NativePlace,"+
							"Nation,"+
							"Birthday,"+
							"IDCard,"+
							"IDCardPic,"+
							"IsPassIDCard,"+
							"IDCardProvince,"+
							"IDCardCity,"+
							"IDCardArea,"+
							"IDCardAddress,"+
							"BankName,"+
							"BankAccount,"+
							"BankCard,"+
							"BankCardPic,"+
							"IsPassBankCard,"+
							"Marriage,"+
							"Family,"+
							"Income,"+
							"Education,"+
							"GraduateFrom,"+
							"InterestsOfLife,"+
							"InterestsOfCulture,"+
							"InterestsOfAmusement,"+
							"InterestsOfSport,"+
							"InterestsOfOther,"+
							"CreateTime,"+
							"UpdateTime,"+
							"Owner,"+
							"EmergencyContact) "+
							"values("+
							"@ContacterID,"+
							"@ClientID,"+
							"@ParentID,"+
							"@UserName,"+
							"@UserType,"+
							"@TrueName,"+
							"@Sex,"+
							"@Title,"+
							"@Company,"+
							"@Department,"+
							"@Position,"+
							"@Operation,"+
							"@CompanyAddress,"+
							"@CompanySize,"+
							"@CompanyType,"+
							"@CompanyIndustry,"+
							"@Email,"+
							"@Homepage,"+
							"@QQ,"+
							"@ICQ,"+
							"@MSN,"+
							"@Yahoo,"+
							"@UC,"+
							"@Aim,"+
							"@OfficePhone,"+
							"@HomePhone,"+
							"@PHS,"+
							"@Fax,"+
							"@Mobile,"+
							"@Country,"+
							"@Province,"+
							"@City,"+
							"@Area,"+
							"@Address,"+
							"@ZipCode,"+
							"@NativePlace,"+
							"@Nation,"+
							"@Birthday,"+
							"@IDCard,"+
							"@IDCardPic,"+
							"@IsPassIDCard,"+
							"@IDCardProvince,"+
							"@IDCardCity,"+
							"@IDCardArea,"+
							"@IDCardAddress,"+
							"@BankName,"+
							"@BankAccount,"+
							"@BankCard,"+
							"@BankCardPic,"+
							"@IsPassBankCard,"+
							"@Marriage,"+
							"@Family,"+
							"@Income,"+
							"@Education,"+
							"@GraduateFrom,"+
							"@InterestsOfLife,"+
							"@InterestsOfCulture,"+
							"@InterestsOfAmusement,"+
							"@InterestsOfSport,"+
							"@InterestsOfOther,"+
							"@CreateTime,"+
							"@UpdateTime,"+
							"@Owner,"+
							"@EmergencyContact)";
			if(await Task.Run(() => _DB.ExeSQLResult(strSQL, dict)))
			{
				return DataConverter.CLng(entity.ContacterID);
			}
			return -1;
		}

		/// <summary>
		/// 增加或更新一条记录
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <param name="IsSave">是否增加</param>
		/// <returns></returns>
		public virtual bool AddOrUpdate(ContacterEntity entity, bool IsSave)
		{
			return IsSave ? Add(entity) : Update(entity);
		}
		/// <summary>
		/// 增加或更新一条记录（异步方式）
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <param name="IsSave">是否增加</param>
		/// <returns></returns>
		public virtual async Task<bool> AddOrUpdateAsync(ContacterEntity entity, bool IsSave)
		{
			return IsSave ? await AddAsync(entity) : await UpdateAsync(entity);
		}
		#endregion
		
		#region 删除
		/// <summary>
		/// 通过主键删除
		/// </summary>
		/// <returns></returns>
		public bool Delete(System.Int32 contacterID)
		{
			string strSQL = "delete from Contacter where " +
			
			"ContacterID = @ContacterID"; 
			
			Dictionary<string, object> dict = new Dictionary<string, object>();
			dict.Add("ContacterID", contacterID);
			
			return _DB.ExeSQLResult(strSQL, dict);
		}
		/// <summary>
		/// 通过主键删除
		/// </summary>
		/// <returns></returns>
		public async Task<bool> DeleteAsync(System.Int32 contacterID)
		{
			string strSQL = "delete from Contacter where " +
			
			"ContacterID = @ContacterID"; 
			
			Dictionary<string, object> dict = new Dictionary<string, object>();
			dict.Add("ContacterID", contacterID);
			
			return await Task.Run(() => _DB.ExeSQLResult(strSQL, dict));
		}
		
		/// <summary>
		/// 删除一条或多条记录
		/// </summary>
		/// <param name="strWhere">参数化删除条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual bool Delete(string strWhere, Dictionary<string, object> dict = null)
		{
			string strSQL = "delete from Contacter where 1=1 " + strWhere;
			return _DB.ExeSQLResult(strSQL, dict);
		}
		/// <summary>
		/// 删除一条或多条记录（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化删除条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual async Task<bool> DeleteAsync(string strWhere, Dictionary<string, object> dict = null)
		{
			string strSQL = "delete from Contacter where 1=1 " + strWhere;
			return await Task.Run(() => _DB.ExeSQLResult(strSQL, dict));
		}
		#endregion
		
		#region 修改
		/// <summary>
		/// 更新一条记录
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual bool Update(ContacterEntity entity)
		{
			Dictionary<string, object> dict = new Dictionary<string, object>();
			GetParameters(entity, dict);
			string strSQL = "Update Contacter SET "+
			"ClientID = @ClientID,"+
			"ParentID = @ParentID,"+
			"UserName = @UserName,"+
			"UserType = @UserType,"+
			"TrueName = @TrueName,"+
			"Sex = @Sex,"+
			"Title = @Title,"+
			"Company = @Company,"+
			"Department = @Department,"+
			"Position = @Position,"+
			"Operation = @Operation,"+
			"CompanyAddress = @CompanyAddress,"+
			"CompanySize = @CompanySize,"+
			"CompanyType = @CompanyType,"+
			"CompanyIndustry = @CompanyIndustry,"+
			"Email = @Email,"+
			"Homepage = @Homepage,"+
			"QQ = @QQ,"+
			"ICQ = @ICQ,"+
			"MSN = @MSN,"+
			"Yahoo = @Yahoo,"+
			"UC = @UC,"+
			"Aim = @Aim,"+
			"OfficePhone = @OfficePhone,"+
			"HomePhone = @HomePhone,"+
			"PHS = @PHS,"+
			"Fax = @Fax,"+
			"Mobile = @Mobile,"+
			"Country = @Country,"+
			"Province = @Province,"+
			"City = @City,"+
			"Area = @Area,"+
			"Address = @Address,"+
			"ZipCode = @ZipCode,"+
			"NativePlace = @NativePlace,"+
			"Nation = @Nation,"+
			"Birthday = @Birthday,"+
			"IDCard = @IDCard,"+
			"IDCardPic = @IDCardPic,"+
			"IsPassIDCard = @IsPassIDCard,"+
			"IDCardProvince = @IDCardProvince,"+
			"IDCardCity = @IDCardCity,"+
			"IDCardArea = @IDCardArea,"+
			"IDCardAddress = @IDCardAddress,"+
			"BankName = @BankName,"+
			"BankAccount = @BankAccount,"+
			"BankCard = @BankCard,"+
			"BankCardPic = @BankCardPic,"+
			"IsPassBankCard = @IsPassBankCard,"+
			"Marriage = @Marriage,"+
			"Family = @Family,"+
			"Income = @Income,"+
			"Education = @Education,"+
			"GraduateFrom = @GraduateFrom,"+
			"InterestsOfLife = @InterestsOfLife,"+
			"InterestsOfCulture = @InterestsOfCulture,"+
			"InterestsOfAmusement = @InterestsOfAmusement,"+
			"InterestsOfSport = @InterestsOfSport,"+
			"InterestsOfOther = @InterestsOfOther,"+
			"CreateTime = @CreateTime,"+
			"UpdateTime = @UpdateTime,"+
			"Owner = @Owner,"+
			"EmergencyContact = @EmergencyContact"+
			" WHERE "+
			
			"ContacterID = @ContacterID"; 
			
			return _DB.ExeSQLResult(strSQL, dict);
		}
		/// <summary>
		/// 更新一条记录（异步方式）
		/// </summary>
		/// <param name="entity">实体模型</param>
		/// <returns></returns>
		public virtual async Task<bool> UpdateAsync(ContacterEntity entity)
		{
			Dictionary<string, object> dict = new Dictionary<string, object>();
			GetParameters(entity, dict);
			string strSQL = "Update Contacter SET "+
			"ClientID = @ClientID,"+
			"ParentID = @ParentID,"+
			"UserName = @UserName,"+
			"UserType = @UserType,"+
			"TrueName = @TrueName,"+
			"Sex = @Sex,"+
			"Title = @Title,"+
			"Company = @Company,"+
			"Department = @Department,"+
			"Position = @Position,"+
			"Operation = @Operation,"+
			"CompanyAddress = @CompanyAddress,"+
			"CompanySize = @CompanySize,"+
			"CompanyType = @CompanyType,"+
			"CompanyIndustry = @CompanyIndustry,"+
			"Email = @Email,"+
			"Homepage = @Homepage,"+
			"QQ = @QQ,"+
			"ICQ = @ICQ,"+
			"MSN = @MSN,"+
			"Yahoo = @Yahoo,"+
			"UC = @UC,"+
			"Aim = @Aim,"+
			"OfficePhone = @OfficePhone,"+
			"HomePhone = @HomePhone,"+
			"PHS = @PHS,"+
			"Fax = @Fax,"+
			"Mobile = @Mobile,"+
			"Country = @Country,"+
			"Province = @Province,"+
			"City = @City,"+
			"Area = @Area,"+
			"Address = @Address,"+
			"ZipCode = @ZipCode,"+
			"NativePlace = @NativePlace,"+
			"Nation = @Nation,"+
			"Birthday = @Birthday,"+
			"IDCard = @IDCard,"+
			"IDCardPic = @IDCardPic,"+
			"IsPassIDCard = @IsPassIDCard,"+
			"IDCardProvince = @IDCardProvince,"+
			"IDCardCity = @IDCardCity,"+
			"IDCardArea = @IDCardArea,"+
			"IDCardAddress = @IDCardAddress,"+
			"BankName = @BankName,"+
			"BankAccount = @BankAccount,"+
			"BankCard = @BankCard,"+
			"BankCardPic = @BankCardPic,"+
			"IsPassBankCard = @IsPassBankCard,"+
			"Marriage = @Marriage,"+
			"Family = @Family,"+
			"Income = @Income,"+
			"Education = @Education,"+
			"GraduateFrom = @GraduateFrom,"+
			"InterestsOfLife = @InterestsOfLife,"+
			"InterestsOfCulture = @InterestsOfCulture,"+
			"InterestsOfAmusement = @InterestsOfAmusement,"+
			"InterestsOfSport = @InterestsOfSport,"+
			"InterestsOfOther = @InterestsOfOther,"+
			"CreateTime = @CreateTime,"+
			"UpdateTime = @UpdateTime,"+
			"Owner = @Owner,"+
			"EmergencyContact = @EmergencyContact"+
			" WHERE "+
			
			"ContacterID = @ContacterID"; 
			return await Task.Run(() => _DB.ExeSQLResult(strSQL, dict));
		}

		/// <summary>
		/// 修改一条或多条记录
		/// </summary>
		/// <param name="strColumns">参数化要修改的列（如：ID = @ID,Name = @Name）</param>
		/// <param name="dictColumns">包含要修改的名称和值的集合,对应strColumns参数中要修改列的值</param>
		/// <param name="strWhere">参数化修改条件(例如: and ID = @ID)</param>
		/// <param name="dictWhere">包含查询名称和值的集合,对应strWhere参数中的值</param>
		/// <returns></returns>
		public virtual bool Update(string strColumns, Dictionary<string, object> dictColumns = null, string strWhere = "", Dictionary<string, object> dictWhere = null)
		{
			if (string.IsNullOrEmpty(strColumns))
				return false;

			strColumns = StringHelper.ReplaceIgnoreCase(strColumns, "@", "@UP_");
			string strSQL = "Update Contacter SET " + strColumns + " where 1=1 " + strWhere;

			Dictionary<string, object> dict = new Dictionary<string, object>();
			//生成要修改列的参数
			foreach (KeyValuePair<string, object> kvp in dictColumns)
			{
				dict.Add("@UP_" + kvp.Key,kvp.Value);
			}
			//生成查询条件的参数
			foreach (KeyValuePair<string, object> kvp in dictWhere)
			{
				dict.Add(kvp.Key, kvp.Value);
			}

			return _DB.ExeSQLResult(strSQL, dict);
		}
		/// <summary>
		/// 修改一条或多条记录（异步方式）
		/// </summary>
		/// <param name="strColumns">参数化要修改的列（如：ID = @ID,Name = @Name）</param>
		/// <param name="dictColumns">包含要修改的名称和值的集合,对应strColumns参数中要修改列的值</param>
		/// <param name="strWhere">参数化修改条件(例如: and ID = @ID)</param>
		/// <param name="dictWhere">包含查询名称和值的集合,对应strWhere参数中的值</param>
		/// <returns></returns>
		public virtual async Task<bool> UpdateAsync(string strColumns, Dictionary<string, object> dictColumns = null, string strWhere = "", Dictionary<string, object> dictWhere = null)
		{
			if (string.IsNullOrEmpty(strColumns))
				return false;

			strColumns = StringHelper.ReplaceIgnoreCase(strColumns, "@", "@UP_");
			string strSQL = "Update Contacter SET " + strColumns + " where 1=1 " + strWhere;

			Dictionary<string, object> dict = new Dictionary<string, object>();
			//生成要修改列的参数
			foreach (KeyValuePair<string, object> kvp in dictColumns)
			{
				dict.Add("@UP_" + kvp.Key, kvp.Value);
			}
			//生成查询条件的参数
			foreach (KeyValuePair<string, object> kvp in dictWhere)
			{
				dict.Add(kvp.Key, kvp.Value);
			}
			return await Task.Run(() => _DB.ExeSQLResult(strSQL, dict));
		}
		#endregion
		
		#region 得到实体
		/// <summary>
		/// 通过主键返回第一条信息的实体类。
		/// </summary>
		/// <returns></returns>
		public ContacterEntity GetEntity(System.Int32 contacterID)
		{
			string strCondition = string.Empty;
			strCondition += " and ContacterID = @ContacterID";
			
			Dictionary<string, object> dict = new Dictionary<string, object>();
			dict.Add("ContacterID", contacterID);
			
			return GetEntity(strCondition,dict);
		}
		/// <summary>
		/// 通过主键返回第一条信息的实体类。
		/// </summary>
		/// <returns></returns>
		public async Task<ContacterEntity> GetEntityAsync(System.Int32 contacterID)
		{
			string strCondition = string.Empty;
			strCondition += " and ContacterID = @ContacterID";
			
			Dictionary<string, object> dict = new Dictionary<string, object>();
			dict.Add("ContacterID", contacterID);
			
			return await GetEntityAsync(strCondition,dict);
		}
		
		/// <summary>
		/// 获取实体
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual ContacterEntity GetEntity(string strWhere, Dictionary<string, object> dict = null)
		{
			ContacterEntity obj = null;
			string strSQL = "select top 1 * from Contacter where 1=1 " + strWhere;
			using (NullableDataReader reader = _DB.GetDataReader(strSQL, dict))
			{
				if (reader.Read())
				{
					obj = GetEntityFromrdr(reader);
				}
			}
			return obj;
		}
		/// <summary>
		/// 获取实体（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual async Task<ContacterEntity> GetEntityAsync(string strWhere, Dictionary<string, object> dict = null)
		{
			ContacterEntity obj = null;
			string strSQL = "select top 1 * from Contacter where 1=1 " + strWhere;
			using (NullableDataReader reader = await Task.Run(() => _DB.GetDataReader(strSQL, dict)))
			{
				if (reader.Read())
				{
					obj = GetEntityFromrdr(reader);
				}
			}
			return obj;
		}
		#endregion
		
		#region 得到实体列表
		/// <summary>
		/// 得到实体列表
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual IList<ContacterEntity> GetEntityList(string strWhere="", Dictionary<string, object> dict = null)
		{
			IList<ContacterEntity> list = new List<ContacterEntity>();
			string strSQL = "select * from Contacter where 1=1 ";
			if(!string.IsNullOrEmpty(strWhere))
			{
				strSQL += strWhere;
			}
			using (NullableDataReader reader = _DB.GetDataReader(strSQL, dict))
			{
				while (reader.Read())
				{
					list.Add(GetEntityFromrdr(reader));
				}
			}
			return list;
		}
		/// <summary>
		/// 得到实体列表（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual async Task<IList<ContacterEntity>> GetEntityListAsync(string strWhere = "", Dictionary<string, object> dict = null)
		{
			IList<ContacterEntity> list = new List<ContacterEntity>();
			string strSQL = "select * from Contacter where 1=1 ";
			if (!string.IsNullOrEmpty(strWhere))
			{
				strSQL += strWhere;
			}
			using (NullableDataReader reader = await Task.Run(() => _DB.GetDataReader(strSQL, dict)))
			{
				while (reader.Read())
				{
					list.Add(GetEntityFromrdr(reader));
				}
			}
			return list;
		}
		#endregion
		
		#region 得到数据列表
		/// <summary>
		/// 返回所有信息
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual DataTable GetAllData(string strWhere = "", Dictionary<string, object> dict = null)
		{
			string strSQL = "select * from Contacter where 1=1 ";
			if(!string.IsNullOrEmpty(strWhere))
			{
				strSQL += strWhere;
			}
			return _DB.GetDataTable(strSQL, dict);
		}
		/// <summary>
		/// 返回所有信息（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <returns></returns>
		public virtual async Task<DataTable> GetAllDataAsync(string strWhere = "", Dictionary<string, object> dict = null)
		{
			string strSQL = "select * from Contacter where 1=1 ";
			if(!string.IsNullOrEmpty(strWhere))
			{
				strSQL += strWhere;
			}
			return await Task.Run(() => _DB.GetDataTable(strSQL, dict));
		}

		/// <summary>
		/// 返回所有信息
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <param name="strExtended">返回的指定列(例如: extended = id + name 或 distinct name)</param>
		/// <returns></returns>
		public virtual DataTable GetAllData(string strWhere = "", Dictionary<string, object> dict = null, string strExtended="*")
		{
			string strSQL = "select " + strExtended + " from Contacter where 1=1 ";
			if(!string.IsNullOrEmpty(strWhere))
			{
				strSQL += strWhere;
			}
			return _DB.GetDataTable(strSQL, dict);
		}
		/// <summary>
		/// 返回所有信息（异步方式）
		/// </summary>
		/// <param name="strWhere">参数化查询条件(例如: and Name = @Name )</param>
		/// <param name="dict">参数的名/值集合</param>
		/// <param name="strExtended">返回的指定列(例如: extended = id + name 或 distinct name)</param>
		/// <returns></returns>
		public virtual async Task<DataTable> GetAllDataAsync(string strWhere = "", Dictionary<string, object> dict = null, string strExtended = "*")
		{
			string strSQL = "select " + strExtended + " from Contacter where 1=1 ";
			if(!string.IsNullOrEmpty(strWhere))
			{
				strSQL += strWhere;
			}
			return await Task.Run(() => _DB.GetDataTable(strSQL, dict));
		}
		#endregion
		
		#region 分页
		/// <summary>
		/// 通过存储过程"Common_GetList"，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
        /// <param name="maxNumberRows">每页最大显示数量</param>
        /// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <returns></returns>
		public IList<ContacterEntity> GetList(int startRowIndexId, int maxNumberRows,string Filter, out int Total)
		{
			Total = 0;
			return GetList(startRowIndexId,maxNumberRows,"","","",Filter,"",out Total);
		}
		/// <summary>
		/// 通过存储过程“Common_GetList”，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="SortColumn">排序字段名，只能指定一个字段</param>
		/// <param name="StrColumn">返回列名</param>
		/// <param name="Sorts">排序方式（DESC,ASC）</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="TableName">查询表名，可以指定联合查询的SQL语句(例如: Comment LEFT JOIN Users ON Comment.UserName = Users.UserName)</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <returns></returns>
		public virtual IList<ContacterEntity> GetList(int startRowIndexId, int maxNumberRows, string SortColumn, string StrColumn, string Sorts, string Filter, string TableName, out int Total)
		{
			IList<ContacterEntity> list = new List<ContacterEntity>();
			if (string.IsNullOrEmpty(SortColumn))
			{
				SortColumn = "ContacterID";
			}
			if (string.IsNullOrEmpty(StrColumn))
			{
				StrColumn = "*";
			}
			if (string.IsNullOrEmpty(Sorts))
			{
				Sorts = "DESC";
			}
			if (string.IsNullOrEmpty(TableName))
			{
				TableName = "Contacter";
			}
			string storedProcedureName = "Common_GetList";
			SqlParameter parmStartRows = new SqlParameter("StartRows", startRowIndexId);
			SqlParameter parmPageSize = new SqlParameter("PageSize", maxNumberRows);
			SqlParameter parmSortColumn = new SqlParameter("SortColumn", SortColumn);
			SqlParameter parmStrColumn = new SqlParameter("StrColumn", StrColumn);
			SqlParameter parmSorts = new SqlParameter("Sorts", Sorts);
			SqlParameter parmTableName = new SqlParameter("TableName", TableName);
			SqlParameter parmFilter = new SqlParameter("Filter", Filter);
			SqlParameter parmTotal = new SqlParameter("Total", SqlDbType.Int);
			parmTotal.Direction = ParameterDirection.Output;
			IDataParameter[] parameterArray = new IDataParameter[8];
			parameterArray[0] = parmStartRows;
			parameterArray[1] = parmPageSize;
			parameterArray[2] = parmSortColumn;
			parameterArray[3] = parmStrColumn;
			parameterArray[4] = parmSorts;
			parameterArray[5] = parmTableName;
			parameterArray[6] = parmFilter;
			parameterArray[7] = parmTotal;
			using (NullableDataReader reader = _DB.GetDataReaderByProc(storedProcedureName, parameterArray))
			{
				while (reader.Read())
				{
					list.Add(GetEntityFromrdr(reader));
				}
			}
			Total = (int)parmTotal.Value;
			return list;
		}

		/// <summary>
		/// 通过存储过程"Common_GetListBySortColumn"，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
        /// <param name="maxNumberRows">每页最大显示数量</param>
        /// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <returns></returns>
		public IList<ContacterEntity> GetListBySortColumn(int startRowIndexId, int maxNumberRows,string Filter, out int Total)
		{
			Total = 0;
			return GetListBySortColumn(startRowIndexId,maxNumberRows,"","","","","",Filter,"",out Total);
		}
		/// <summary>
		/// 通过存储过程"Common_GetListBySortColumn"，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
        /// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="Sorts">排序方式（DESC,ASC）</param>
        /// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <returns></returns>
		public IList<ContacterEntity> GetListBySortColumn(int startRowIndexId, int maxNumberRows,string Sorts,string Filter, out int Total)
		{
			Total = 0;
			return GetListBySortColumn(startRowIndexId,maxNumberRows,"","","","",Sorts,Filter,"",out Total);
		}
		/// <summary>
		/// 通过存储过程“Common_GetListBySortColumn”，得到分页后的数据
		/// </summary>
		/// <param name="startRowIndexId">开始行索引</param>
		/// <param name="maxNumberRows">每页最大显示数量</param>
		/// <param name="PrimaryColumn">主键字段名</param>
		/// <param name="SortColumnDbType">排序字段的数据类型(如：int)</param>
		/// <param name="SortColumn">排序字段名，只能指定一个字段</param>
		/// <param name="StrColumn">返回列名</param>
		/// <param name="Sorts">排序方式（DESC,ASC）</param>
		/// <param name="Filter">查询条件(例如: Name = 'name' and id=1 )</param>
		/// <param name="TableName">查询表名，可以指定联合查询的SQL语句(例如: Comment LEFT JOIN Users ON Comment.UserName = Users.UserName)</param>
		/// <param name="Total">输出参数：查询总数</param>
		/// <returns></returns>
		public virtual IList<ContacterEntity> GetListBySortColumn(int startRowIndexId, int maxNumberRows, string PrimaryColumn, string SortColumnDbType, string SortColumn, string StrColumn, string Sorts, string Filter, string TableName, out int Total)
		{
			IList<ContacterEntity> list = new List<ContacterEntity>();
			if (string.IsNullOrEmpty(PrimaryColumn))
			{
				PrimaryColumn = "ContacterID";
			}
			if (string.IsNullOrEmpty(SortColumnDbType))
			{
				SortColumnDbType = "int";
			}
			if (string.IsNullOrEmpty(SortColumn))
			{
				SortColumn = "ContacterID";
			}
			if (string.IsNullOrEmpty(StrColumn))
			{
				StrColumn = "*";
			}
			if (string.IsNullOrEmpty(Sorts))
			{
				Sorts = "DESC";
			}
			if (string.IsNullOrEmpty(TableName))
			{
				TableName = "Contacter";
			}
			string storedProcedureName = "Common_GetListBySortColumn";
			SqlParameter parmStartRows = new SqlParameter("StartRows", startRowIndexId);
			SqlParameter parmPageSize = new SqlParameter("PageSize", maxNumberRows);
			SqlParameter parmPrimaryColumn = new SqlParameter("PrimaryColumn", PrimaryColumn);
			SqlParameter parmSortColumnDbType = new SqlParameter("SortColumnDbType", SortColumnDbType);
			SqlParameter parmSortColumn = new SqlParameter("SortColumn", SortColumn);
			SqlParameter parmStrColumn = new SqlParameter("StrColumn", StrColumn);
			SqlParameter parmSorts = new SqlParameter("Sorts", Sorts);
			SqlParameter parmTableName = new SqlParameter("TableName", TableName);
			SqlParameter parmFilter = new SqlParameter("Filter", Filter);
			SqlParameter parmTotal = new SqlParameter("Total", SqlDbType.Int);
			parmTotal.Direction = ParameterDirection.Output;
			IDataParameter[] parameterArray = new IDataParameter[10];
			parameterArray[0] = parmStartRows;
			parameterArray[1] = parmPageSize;
			parameterArray[2] = parmPrimaryColumn;
			parameterArray[3] = parmSortColumnDbType;
			parameterArray[4] = parmSortColumn;
			parameterArray[5] = parmStrColumn;
			parameterArray[6] = parmSorts;
			parameterArray[7] = parmTableName;
			parameterArray[8] = parmFilter;
			parameterArray[9] = parmTotal;
			using (NullableDataReader reader = _DB.GetDataReaderByProc(storedProcedureName, parameterArray))
			{
				while (reader.Read())
				{
					list.Add(GetEntityFromrdr(reader));
				}
			}
			Total = (int)parmTotal.Value;
			return list;
		}
		#endregion
		
		#region 辅助方法
		/// <summary>
		/// 把实体类转换成键/值对集合
		/// </summary>
		/// <param name="entity"></param>
		/// <param name="dict"></param>
		private static void GetParameters(ContacterEntity entity, Dictionary<string, object> dict)
		{
			dict.Add("ContacterID", entity.ContacterID);
			dict.Add("ClientID", entity.ClientID);
			dict.Add("ParentID", entity.ParentID);
			dict.Add("UserName", entity.UserName);
			dict.Add("UserType", entity.UserType);
			dict.Add("TrueName", entity.TrueName);
			dict.Add("Sex", entity.Sex);
			dict.Add("Title", entity.Title);
			dict.Add("Company", entity.Company);
			dict.Add("Department", entity.Department);
			dict.Add("Position", entity.Position);
			dict.Add("Operation", entity.Operation);
			dict.Add("CompanyAddress", entity.CompanyAddress);
			dict.Add("CompanySize", entity.CompanySize);
			dict.Add("CompanyType", entity.CompanyType);
			dict.Add("CompanyIndustry", entity.CompanyIndustry);
			dict.Add("Email", entity.Email);
			dict.Add("Homepage", entity.Homepage);
			dict.Add("QQ", entity.QQ);
			dict.Add("ICQ", entity.ICQ);
			dict.Add("MSN", entity.MSN);
			dict.Add("Yahoo", entity.Yahoo);
			dict.Add("UC", entity.UC);
			dict.Add("Aim", entity.Aim);
			dict.Add("OfficePhone", entity.OfficePhone);
			dict.Add("HomePhone", entity.HomePhone);
			dict.Add("PHS", entity.PHS);
			dict.Add("Fax", entity.Fax);
			dict.Add("Mobile", entity.Mobile);
			dict.Add("Country", entity.Country);
			dict.Add("Province", entity.Province);
			dict.Add("City", entity.City);
			dict.Add("Area", entity.Area);
			dict.Add("Address", entity.Address);
			dict.Add("ZipCode", entity.ZipCode);
			dict.Add("NativePlace", entity.NativePlace);
			dict.Add("Nation", entity.Nation);
			dict.Add("Birthday", entity.Birthday);
			dict.Add("IDCard", entity.IDCard);
			dict.Add("IDCardPic", entity.IDCardPic);
			dict.Add("IsPassIDCard", entity.IsPassIDCard);
			dict.Add("IDCardProvince", entity.IDCardProvince);
			dict.Add("IDCardCity", entity.IDCardCity);
			dict.Add("IDCardArea", entity.IDCardArea);
			dict.Add("IDCardAddress", entity.IDCardAddress);
			dict.Add("BankName", entity.BankName);
			dict.Add("BankAccount", entity.BankAccount);
			dict.Add("BankCard", entity.BankCard);
			dict.Add("BankCardPic", entity.BankCardPic);
			dict.Add("IsPassBankCard", entity.IsPassBankCard);
			dict.Add("Marriage", entity.Marriage);
			dict.Add("Family", entity.Family);
			dict.Add("Income", entity.Income);
			dict.Add("Education", entity.Education);
			dict.Add("GraduateFrom", entity.GraduateFrom);
			dict.Add("InterestsOfLife", entity.InterestsOfLife);
			dict.Add("InterestsOfCulture", entity.InterestsOfCulture);
			dict.Add("InterestsOfAmusement", entity.InterestsOfAmusement);
			dict.Add("InterestsOfSport", entity.InterestsOfSport);
			dict.Add("InterestsOfOther", entity.InterestsOfOther);
			dict.Add("CreateTime", entity.CreateTime);
			dict.Add("UpdateTime", entity.UpdateTime);
			dict.Add("Owner", entity.Owner);
			dict.Add("EmergencyContact", entity.EmergencyContact);
		}
		/// <summary>
		/// 通过数据读取器生成实体类
		/// </summary>
		/// <param name="rdr"></param>
		/// <returns></returns>
		private static ContacterEntity GetEntityFromrdr(NullableDataReader rdr)
		{
			ContacterEntity info = new ContacterEntity();
			info.ContacterID = rdr.GetInt32("ContacterID");
			info.ClientID = rdr.GetInt32("ClientID");
			info.ParentID = rdr.GetInt32("ParentID");
			info.UserName = rdr.GetString("UserName");
			info.UserType = rdr.GetInt32("UserType");
			info.TrueName = rdr.GetString("TrueName");
			info.Sex = rdr.GetInt32("Sex");
			info.Title = rdr.GetString("Title");
			info.Company = rdr.GetString("Company");
			info.Department = rdr.GetString("Department");
			info.Position = rdr.GetString("Position");
			info.Operation = rdr.GetString("Operation");
			info.CompanyAddress = rdr.GetString("CompanyAddress");
			info.CompanySize = rdr.GetString("CompanySize");
			info.CompanyType = rdr.GetString("CompanyType");
			info.CompanyIndustry = rdr.GetString("CompanyIndustry");
			info.Email = rdr.GetString("Email");
			info.Homepage = rdr.GetString("Homepage");
			info.QQ = rdr.GetString("QQ");
			info.ICQ = rdr.GetString("ICQ");
			info.MSN = rdr.GetString("MSN");
			info.Yahoo = rdr.GetString("Yahoo");
			info.UC = rdr.GetString("UC");
			info.Aim = rdr.GetString("Aim");
			info.OfficePhone = rdr.GetString("OfficePhone");
			info.HomePhone = rdr.GetString("HomePhone");
			info.PHS = rdr.GetString("PHS");
			info.Fax = rdr.GetString("Fax");
			info.Mobile = rdr.GetString("Mobile");
			info.Country = rdr.GetString("Country");
			info.Province = rdr.GetString("Province");
			info.City = rdr.GetString("City");
			info.Area = rdr.GetString("Area");
			info.Address = rdr.GetString("Address");
			info.ZipCode = rdr.GetString("ZipCode");
			info.NativePlace = rdr.GetString("NativePlace");
			info.Nation = rdr.GetString("Nation");
			info.Birthday = rdr.GetNullableDateTime("Birthday");
			info.IDCard = rdr.GetString("IDCard");
			info.IDCardPic = rdr.GetString("IDCardPic");
			info.IsPassIDCard = rdr.GetInt32("IsPassIDCard");
			info.IDCardProvince = rdr.GetString("IDCardProvince");
			info.IDCardCity = rdr.GetString("IDCardCity");
			info.IDCardArea = rdr.GetString("IDCardArea");
			info.IDCardAddress = rdr.GetString("IDCardAddress");
			info.BankName = rdr.GetString("BankName");
			info.BankAccount = rdr.GetString("BankAccount");
			info.BankCard = rdr.GetString("BankCard");
			info.BankCardPic = rdr.GetString("BankCardPic");
			info.IsPassBankCard = rdr.GetInt32("IsPassBankCard");
			info.Marriage = rdr.GetInt32("Marriage");
			info.Family = rdr.GetString("Family");
			info.Income = rdr.GetInt32("Income");
			info.Education = rdr.GetInt32("Education");
			info.GraduateFrom = rdr.GetString("GraduateFrom");
			info.InterestsOfLife = rdr.GetString("InterestsOfLife");
			info.InterestsOfCulture = rdr.GetString("InterestsOfCulture");
			info.InterestsOfAmusement = rdr.GetString("InterestsOfAmusement");
			info.InterestsOfSport = rdr.GetString("InterestsOfSport");
			info.InterestsOfOther = rdr.GetString("InterestsOfOther");
			info.CreateTime = rdr.GetNullableDateTime("CreateTime");
			info.UpdateTime = rdr.GetNullableDateTime("UpdateTime");
			info.Owner = rdr.GetString("Owner");
			info.EmergencyContact = rdr.GetString("EmergencyContact");
			return info;
		}
		#endregion
	}
}